import java.util.concurrent.atomic.AtomicInteger;

public class AtmoticInt {
    private static AtomicInteger num=new AtomicInteger(0);
    private static Object lock = new Object();

    public static void main(String[] args) {
        for (int i = 0; i < 3; i++) {
            Thread thread=new Thread(new Runnable() {
                @Override
                public void run() {
                    while (num.get()<1000) {
                            System.out.print(Thread.currentThread().getName()+num.incrementAndGet());
                    }
                }
            });
            thread.start();
        }

    }

}
